package com.book.controller;


import com.book.model.Operator;
import com.book.service.OperatorService;
import com.book.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wx
 * @since 2023-10-12 08:17:13
 */
@RestController
@RequestMapping("/operator")
public class OperatorController {

    @Autowired
    private OperatorService operatorService;
    @Autowired
    private RoleService roleService;
    @GetMapping("getAll")
    public List<Operator> getAll(){
       return operatorService.getAll();
    }
    @PostMapping("addOperator")
    public void addOperator(Operator operator,Long[] rid){
        operatorService.addOperator(operator,rid);
    }
    @PutMapping("updaterOperator")
    public void updaterOperator(Operator operator,Long[] rid){

        operatorService.updaterOperator(operator,rid);
    }

   @DeleteMapping("deleteOperator")
    public void deleteOperator(Long oid){
        operatorService.deleteOperator(oid);
   }
}
